import { connect } from 'dva'
import React from 'react'
import styles from './index.less'

const OtherInfo = connect(({infoenterprise, infoaccount})=>({
    enterpriseInfo: infoenterprise.enterpriseInfo,
    accountInfo: infoaccount.accountInfo
}))(
    function OtherInfo(props){
        // 自营店利润分成表：仅有自营店供应商属性时展示
        if(props.enterpriseInfo.spsRateProfitResponses){
            const {
                rateAirParcel='', 
                rateDelivery='', 
                rateLanshou='', 
                ratePickGoods='', 
                leavePort='',
                profitWayLanshou='',
                profitWayParcel='',
                profitWayPickGoods='',
                profitWayDelivery='',
                profitRateLanshou='',
                profitRateParcel='',
                profitRatePickGoods='',
                profitRateDelivery='',
                profitDateLanshou='',
                profitDateParcel='',
                profitDatePickGoods='',
                profitDateDelivery='',
            } = props.enterpriseInfo.spsRateProfitResponses[0]
            return (
                <div>
                    <div className={styles.otherBox}>
                        <div>
                            <h3>运输服务税率</h3>
                            <div className={styles.transportBox}>
                                <div className={styles.innerBox}>
                                    <div className={styles.item}>
                                        <p className={styles.headers}>服务类型</p>
                                        <p>税率</p>
                                    </div>
                                    { rateLanshou ?
                                        (   <div className={styles.item}>
                                                <p className={styles.headers}>揽收</p>
                                                <p>{rateLanshou}%</p>
                                            </div>
                                        ) : null
                                    }
                                    { rateAirParcel ? 
                                        (  <div className={styles.item}>
                                            <p className={styles.headers}>空运</p>
                                                <p>{rateAirParcel}%</p>
                                            </div>
                                        ) : null
                                    }
                                    { leavePort ? 
                                        ( <div className={styles.item}>
                                                <p className={styles.headers}>出港操作</p>
                                                <p>{leavePort}%</p>
                                            </div>
                                        ) : null
                                    }
                                    { ratePickGoods ?
                                        ( <div className={styles.item}>
                                                <p className={styles.headers}>提货</p>
                                                <p>{ratePickGoods}%</p>
                                            </div>
                                        ) : null
                                    }
                                    { rateDelivery ? 
                                        ( <div className={styles.item}>
                                                <p className={styles.headers}>派送</p>
                                                <p>{rateDelivery}%</p>
                                            </div>
                                        ) : null
                                    }        
                                </div>
                            </div>
                            {
                                // 1.专属供应商 2.自营店供应商 3.平台供应商
                               (props.accountInfo.attributeTag &&  props.accountInfo.attributeTag.includes("2")) ?
                                <div style={{marginTop: '20px'}}>
                                    <h3>自营店利润分成</h3>
                                    <div className={styles.profitBox}>
                                        <div className={styles.innerBox}>
                                            <div className={styles.item}>
                                                 <p className={styles.headers}>服务类型</p>
                                                 <p>利润分成方式</p>
                                                 <p className={styles.hightlight}>利润分成税率</p>
                                                 <p>利润分成日期</p>
                                            </div>
                                            <div className={styles.item}>
                                                <p className={styles.headers}>揽收</p>
                                                <p>{profitWayLanshou}</p>
                                                <p className={styles.hightlight}>{profitRateLanshou}</p>
                                                <p>{profitDateLanshou}</p>
                                            </div>
                                            <div className={styles.item}>
                                                <p className={styles.headers}>空运</p>
                                                <p>{profitWayParcel}</p>
                                                <p className={styles.hightlight}>{profitRateParcel}</p>
                                                <p>{profitDateParcel}</p>
                                            </div>
                                            <div className={styles.item}>
                                                <p className={styles.headers}>提货</p>
                                                <p>{profitWayPickGoods}</p>
                                                <p className={styles.hightlight}>{profitRatePickGoods}</p>
                                                <p>{profitDatePickGoods}</p>
                                            </div>
                                            <div className={styles.item}>
                                                <p className={styles.headers}>派送</p>
                                                <p>{profitWayDelivery}</p>
                                                <p className={styles.hightlight}>{profitRateDelivery}</p>
                                                <p>{profitDateDelivery}</p>
                                            </div>
                                        </div>
                                    </div>
                                </div> : null
                            }                        
                        </div>
                    </div>
                </div>
            )
        }
        return <div></div>
    }
)

export default OtherInfo
